<?php
class users_add extends SClass {

    public function process() {
        try {
            if ($this->getControlValue('add')) {
            	ServiceUtils::GetFactory()->getUserService()->addUser(
            	   $this->getControlValue('login'),
            	   $this->getControlValue('password'),
            	   $this->getControlValue('name'),
            	   $this->getControlValue('level')
            	);
            	$this->assign('message', 'ok');
            }
        } catch (ServiceUtils_Exception $exception) {
            $this->assign('errors', $exception->getErrors());
        }
    }

}